#ifndef __SINGLETON_H__
#define __SINGLETON_H__

#include <memory>

#define DEFINE_SINGLETON(cls) \
\
private:\
	static std::auto_ptr<cls> m_pInstance;\
protected:\
	cls(){}\
public:\
	~cls(){}\
	static cls* Instance()\
	{\
		if(!m_pInstance.get())\
		{\
			m_pInstance = std::auto_ptr<cls>(new cls());\
		}\
		return m_pInstance.get();\
	}

#define IMPLEMENT_SINGLETON(cls) \
	std::auto_ptr<cls> cls::m_pInstance(NULL);

#endif